<h1>Task List</h1>
</br>
<% if @task.errors.any? %>
  <div class="row">
    <div class="span4">
      <div id="error_explanation" class="alert alert-error">
        <strong><%= pluralize(@task.errors.count, "error") %> prohibited this task from being saved:</strong>
        <ul>
          <% @task.errors.full_messages.each do |msg| %>
            <li><%= msg %></li>
          <% end %>
        </ul>
      </div>
    </div>
  </div>
<% end %>

<div class="row">

  <div class="span4">

    <%=form_for @task, html: {class: 'form-inline', style: 'padding-botton: 20px'} do |f| %>

      <%= f.label :name, class: 'label label-info' %>
      <%= f.text_field :name, class: 'input-medium' %>
      <%= f.submit 'Add', class: 'btn btn-success' %>
    <% end %>

    <%= link_to_function 'JS Call', '$(this).html("Change by js");', class: 'btn btn-inverse' %>
  </div>
</div>

<div class="row">

  <div class="span4">
    <ul id="list">
      <% @tasks.each do |task| %>
        <%= render 'tasks/item', task: task %>
      <% end %>
    </ul>
  </div>
</div>
